home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / libs / knowhow4 / cursor.h < prev    next >
C/C++ Source or Header  |  1994-10-10  |  708b  |  31 lines

  1. // CURSOR.H
  2.  
  3. #ifndef __CURSOR_H_  // Draws and hides (draws with reverse color)
  4. #define __CURSOR_H_  // symbol '_' under current position
  5.  
  6. #include <graphics.h>
  7. #include <alloc.h>
  8.  
  9. class Cursor
  10.     {
  11.     protected:
  12.     int cx, cy;
  13.     public:
  14.     Cursor() { cx = cy = 0; }
  15.     void show_cursor()
  16.         {
  17.         int i_size = imagesize(0, 0, 3, textheight("M") + 1);
  18.         void* image = (void*)malloc(i_size);
  19.         getimage(cx, cy - textheight("M"), cx, cy, image);
  20.         putimage(cx, cy - textheight("M"), image, NOT_PUT);
  21.         delete image;
  22.         }
  23.  
  24.     void hide_cursor()    { show_cursor();   }
  25.     void set_cursor(int x, int y)
  26.         {
  27.         ::moveto(cx = x, cy = y);
  28.         }
  29.     };
  30.  
  31. #endif __CURSOR_H_